package com.example.micro.dubbo.consumer;

import com.example.micro.dubbo.api.entity.User;
import com.example.micro.dubbo.api.service.IUserService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class Comsumer implements CommandLineRunner {

    @Reference(version = "1.0", parameters = {"unicast", "false"})
    private IUserService userService;

    @Override
    public void run(String... args) throws Exception {
        User user = userService.selectByUserId(2);
        System.out.println(user.getUserName());
    }
}
